<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>Document</title>
</head>

<body>
  <script>
    let set = new Set(["hello", "world"]);

    console.log(set.values());

    set.forEach((i) => console.log(i));

    let a = new Set([1, 2, 3, 4, 5]);
    let b = new Set([3, 4, 2, 7]);
    // 并集
    console.log(new Set([...a, ...b]));

    // 差集
    console.log([...a].filter((i) => !b.has(i)));

    // 交集
    console.log([...a].filter((i) => b.has(i)));
  </script>
</body>

</html>